/*
 * @Author: 晟松
 * @Date: 2021-11-29 23:57:56
 * @LastEditors: 晟松
 * @LastEditTime: 2021-12-06 21:58:05
 * @FilePath: \mini-vue3d:\Code\node\koa2\volunteer-service\src\main\controller\TestController.js
 * @Description:
 */
import Router from "koa-router";
import TestService from "@main/service/TestService";

let testRouter = new Router({
  prefix: "/test",
});

testRouter.get("/", async (ctx) => {
  // ctx.body = '<h1>测试主页</h1>';
  ctx.body = ctx.renderJson(await TestService.test());
});

testRouter.get("/refer", async (ctx) => {
  // ctx.body = '<h1>测试主页</h1>';
  ctx.body = ctx.renderJson(await TestService.refer());
});

testRouter.get("/childselect", async (ctx) => {
  // ctx.body = '<h1>测试主页</h1>';
  ctx.body = ctx.renderJson(await TestService.childSelect());
});

testRouter.get("/hello/:name", async (ctx) => {
  ctx.body = `<h1>你好啊，${ctx.params.name}</h1>`;
});

export default testRouter;
